package com.baizhi.config;

import com.baizhi.interceptor.JWTInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author：请允悲
 * @Slogan：过滤器
 * @Package：com.baizhi.config
 * @Project：springbootjwt
 * @name：InterceptConfig
 * @Date：2023/9/21 11:21
 * @Filename：InterceptConfig
 */
@Configuration
public class InterceptConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //添加拦截器
        registry.addInterceptor(new JWTInterceptor())
                //拦截的路径 需要进行token验证的路径
                .addPathPatterns("/user/test")
                //放行的路径
                .excludePathPatterns("/user/login");
    }
}
